package hot100;

import java.util.Arrays;

public class Solution2300 {
    public int[] successfulPairs(int[] spells, int[] potions, long success) {
        Arrays.sort(potions);
        int[] res = new int[spells.length];
        for (int k = 0; k < spells.length; k++) {
            int i = 0;
            int j = potions.length;
            while (i < j) {
                int mid = (i + j) >> 1;
                if ((long) spells[k] * potions[mid] < success) i = mid + 1;
                else j = mid;
            }
            res[k] = potions.length - i;
        }
        return res;
    }
}
